package com.adinnet.api.peaseLevel.controller;


import com.adinnet.api.peaseLevel.model.PeaseLevel;
import com.adinnet.api.peaseLevel.service.PeaseLevelService;
import com.adinnet.core.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 豆苗成长阶段表 前端控制器
 * </p>
 *
 * @author chenjia
 * @since 2020-12-03
 */
@RestController
@RequestMapping("api/peaseLevel")
public class PeaseLevelController {

    @Autowired
    private PeaseLevelService peaseRecordService;

    /**
     *查询豆豆所有成长阶段
     * @return
     */
    @GetMapping("getAllPeaseLevel")
    public JsonResult getAllPeaseLevel() {
        try {
            List<PeaseLevel> peaseRecords = peaseRecordService.getAllPeaseLevel();
            return JsonResult.ok().put("data",peaseRecords);
        }catch (Exception e){
            return JsonResult.error("获取失败");
        }
    }

}
